<?php

header("Content-Type: text/html; charset=UTF-8");


require_once '../model/dbm.php';
require_once '../model/dbm.orm.php';
require_once '../model/conn.php';
require_once '../model/util.php';
require_once 'form.php';
require_once 'fk_information.php';
require_once 'connection.php';
require_once 'generator.php';



$f = new EASYNC_form();
if (util::POST_isset('host')) {
    if (!util::POST_isset('con_padrao')) {

        model_conn::$host = util::POST('host');
        model_conn::$banco = util::POST('banco');
        model_conn::$usuario = util::POST('usuario');
        model_conn::$senha = util::POST('senha');


        model_conn_information_schema::$host = util::POST('host');
        model_conn_information_schema::$usuario = util::POST('usuario');
        model_conn_information_schema::$senha = util::POST('senha');
    }

    $g = new EASYNC_entity_generator();
    $code = $g->generate(
            model_conn::$host,
            model_conn::$usuario,
            model_conn::$senha,
            model_conn::$banco
            );
    $f->formulario($code);
} else {
    $f->formulario();
}
?>